package dongchel.vrp.data;

import dongchel.vrp.entity.City;
import dongchel.vrp.entity.GlobalInformation;

public class Cplex {
	public String getDemand(){
		StringBuilder sb = new StringBuilder();
		sb.append("Demands = [\n");
		for(int i=0;i<GlobalInformation.cityList.size();i++){
			City city = GlobalInformation.cityList.get(i);
			sb.append(city.getDemand()+"\n");
		}
		sb.append("]\n");
		
		return sb.toString();
	}
	
	public String getEtime(){
		StringBuilder sb = new StringBuilder();
		sb.append("etime = [\n");
		for(int i=0;i<GlobalInformation.cityList.size();i++){
			City city = GlobalInformation.cityList.get(i);
			sb.append(city.getEtime()+"\n");
		}
		sb.append("]\n");
		
		return sb.toString();
	}
	
	public String getLtime(){
		StringBuilder sb = new StringBuilder();
		sb.append("ltime = [\n");
		for(int i=0;i<GlobalInformation.cityList.size();i++){
			City city = GlobalInformation.cityList.get(i);
			sb.append(city.getLtime()+"\n");
		}
		sb.append("]\n");
		
		return sb.toString();
	}
	
	public String getDist(){
		StringBuilder sb = new StringBuilder();
		sb.append("dist = [\n");

		for(int i=0;i<GlobalInformation.cityList.size();i++){
			for(int j=i+1;j<GlobalInformation.cityList.size();j++){				
				sb.append(GlobalInformation.distance[i][j]+"\n");
			}
		}
		sb.append("]\n");
		
		return sb.toString();
	}
	
	public String getIntegerDist(){
		StringBuilder sb = new StringBuilder();
		sb.append("dist = [\n");

		for(int i=0;i<GlobalInformation.cityList.size();i++){
			for(int j=i+1;j<GlobalInformation.cityList.size();j++){				
				sb.append((int)GlobalInformation.distance[i][j]+"\n");
			}
		}
		sb.append("]\n");
		
		return sb.toString();
	}
	
	public static void main(String[] args){
		LoadData loadData = new LoadData();
		loadData.read("data/C101.txt",0);
		Cplex cp = new Cplex();
		System.out.println(cp.getIntegerDist());
		
	}
}
